﻿@using RBS.Common
@using RBS.Core.Extension
@model  RBS.Core.Model.Hotel.H_Hotels
@{
    ViewBag.Title = "酒店基本设置";
    Layout = "~/Views/Shared/_Layout.cshtml";
} 
<script>
    $(function () { 
        //加载城市列表
        /*      $("#city").ProvinceCity();  */  
        $("#submitImg").click(function () {
            if ($("#boy").val().length > 0) {
                ajaxFileUpload(); 
                var obj = this.form.btnSubmit;
                window.setTimeout(function () {
                    obj.click();
                }, 500);
            }
            else {
                alert("请选择图片");
            }
        });

        //alert($("#City").val());
    }); 
  
    function changecity() {
       
        $("#Province").val(document.getElementById('province').value);
        $("#City").val(document.getElementById('city1').value);
        $("#Region").val(document.getElementById('city2').value);
    }
    function ajaxFileUpload() {
        $.ajaxFileUpload(
            {
                url: '@Url.Action("UploadLicense")', //用于文件上传的服务器端请求地址
                secureuri: false, //一般设置为false
                fileElementId: 'boy', //文件上传空间的id属性  <input type="file" id="file" name="file" />
                dataType: 'HTML', //返回值类型 一般设置为json
                success: function (data, status)  //服务器成功响应处理函数
                {
                    //alert(data);
                    $(".photo-list").show();
                    $("#img1").attr("src", "../"+data);
                    $("#showimg").attr("href", "../" + data);
                    $("#License").val(data);
                    if (typeof (data.error) != 'undefined') {
                        if (data.error != '') {
                            alert(data.error);
                        } else {
                            alert(data.msg);
                        }
                    }
                },
                error: function (data, status, e)//服务器响应失败处理函数
                {
                    alert(e);
                }
            }
        );
    }
    function delImgServer(obj, id) {
        //删除图片
        $.dialog.confirm("删除记录后不可恢复，您确定吗？", function () {
            var url = '@Url.Action("HotelLicenseDelete")?ids=' + id;
            $.ajax({
                url: url,
                type: "post",
                dataType: 'json',
                success: function (data) {
                    if (data.IsSuccess) {
                        //$.dialog.alert(data.Msg); 
                        $(".photo-list").hide();

                    }
                    else { 
                        $.dialog.alert(data.Msg);
                    }
                }
            });
        });
    }
    
  
</script>

 
<!--导航栏-->
@{
    @Html.Partial("_Location");
}
<div class="line10"></div>
<!--/导航栏-->
<!--内容-->
<div class="content-tab-wrap">
    <div id="floatHead" class="content-tab">
        <div class="content-tab-ul-wrap">
            <ul>
                <li><a href="javascript:;" onclick="tabs(this);" class="selected">基本信息</a></li>
                <li><a href="javascript:;" onclick="tabs(this);">扩展信息</a></li> 
                <li><a href="javascript:;" onclick="tabs(this);">认证信息</a></li>
            </ul>
        </div>
    </div>
</div>
@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(false)
    @Html.HiddenFor(model => model.H_id)
    @Html.HiddenFor(model => model.AuditStatus)
    <!--酒店基本信息-->
    <div class="tab-content">
        <dl>
            <dt>酒店状态</dt>
            <dd>
                @{
    var status = "";
                }
                @switch (Model.AuditStatus)
                {

                    case 1:
                        status = "未审核";
                        break;
                    case 2:
                        status = "审核未通过 ";
                        break;
                    case 3:
                        status = "审核通过";
                        break;
                    case 4:
                        status = "已认证&nbsp;&nbsp;<a href='#'>查看认证信息</a>";
                        break;
                }
                <span style="color: red">

                    @Html.Raw(status)
                </span>
            </dd>
        </dl>
        <dl>
            <dt>酒店名称</dt>
            <dd>

                @Html.TextBoxFor(model => model.H_Name, null, new { @class = "input normal"  ,datatype = "*" })
                <span class="Validform_checktip">*酒店名称</span>

            </dd>
        </dl>

        <dl>
            <dt>订餐电话</dt>
            <dd>

                @Html.TextBoxFor(model => model.Telphone, null, new { @class = "input normal" ,datatype = "*"  })
                <span class="Validform_checktip">*联系电话</span>

            </dd>
        </dl>
        <dl>
            <dt>联系手机</dt>
            <dd> 
                @Html.TextBoxFor(model => model.Mobile, null, new { @class = "input normal" ,datatype = "*"  })
                <span class="Validform_checktip">*联系手机</span> 
            </dd>
        </dl>
          <dl>
            <dt>营业时间</dt>
              <dd>
                  @{
                 var begintimelist = new List<SelectListItem> { 
                        new SelectListItem { Text = "9:00", Value = "9:00",Selected = true}, 
                        new SelectListItem { Text = "9:30", Value = "9:30" },
                        new SelectListItem { Text = "10:00", Value = "10:00" },
                        new SelectListItem { Text = "10:30", Value = "10:30" },
                        new SelectListItem { Text = "11:00", Value = "11:00" },
                        new SelectListItem { Text = "11:30", Value = "11:30" },
                        new SelectListItem { Text = "12:00", Value = "12:00" },
                        new SelectListItem { Text = "12:30", Value = "12:30" }
                    };
                 var endtimelist = new List<SelectListItem> {  
                        new SelectListItem { Text = "20:00", Value = "20:00" },
                        new SelectListItem { Text = "20:30", Value = "20:30" },
                            new SelectListItem { Text = "21:00", Value = "21:00",Selected = true}, 
                        new SelectListItem { Text = "21:30", Value = "21:30" },
                        new SelectListItem { Text = "22:00", Value = "22:00" },
                        new SelectListItem { Text = "22:30", Value = "22:30" },
                        new SelectListItem { Text = "23:00", Value = "23:00" },
                        new SelectListItem { Text = "23:30", Value = "23:30" }
                    }; 
                  } 
                  <div class="rule-single-select">
                  @Html.DropDownList("ShopBegintime",begintimelist)</div>
                  至
                   <div class="rule-single-select"> @Html.DropDownList("ShopEndtime",endtimelist) </div>
              </dd>
        </dl>
        <dl>
            <dt>菜系</dt>
            <dd> 
              <div class="rule-multi-radio"> 

                    <span id="CuisineSpan">
                        @foreach (var kvp in new RBS.Core.BLL.SYS_DictInfo().GetModelList(" parentId=1 Order by Sequence asc"))
                        {
                            
                                <label for="Cuisine">@kvp.DictName</label>
                                   @Html.RadioButtonFor(model => model.Cuisine, @kvp.DictName, new { @id = "radio1", @name = "rdolstState" })  
                        }
                    </span>
                </div> 
                <span class="Validform_checktip">*菜系</span> 
            </dd>
        </dl>
        <dl>
            <dt>酒店地址</dt>
            <dd>
                @Html.Hidden("Province")
                @Html.Hidden("City")
                @Html.Hidden("Region") 
                @Html.Partial("_City") 
            </dd>
        </dl>
        <dl>
            <dt></dt>
            <dd>
                @Html.TextBoxFor(model => model.Address, null, new { @class = "input normal" ,datatype = "*" })
                                           <span class="Validform_checktip">*酒店地址</span>  
            </dd>
        </dl>
        <dl>
            <dt>位置</dt>
            <dd> 
                @Html.HiddenFor(model => model.Location) 
                <div id="allmap" style="width: 450px;height: 300px; overflow:hidden ;position: relative"> 
                </div>
                 <div id="optionsNarrative" style="  margin-left:0; margin-bottom: 0; z-index: 1000;overflow:hidden ;position: absolute">拖动标注精确详细地址</div>
                @{
                    <script language="javascript">
                        var mapObj, marker;
                        //初始化地图对象，加载地图 
                        mapObj = new AMap.Map('allmap');
                        //添加点标记
                        window.onload=function addMarker() { 
                            marker = new AMap.Marker({
                                icon: "http://webapi.amap.com/images/marker_sprite.png",
                                draggable: true,
                                position: new AMap.LngLat(@Model.Location)
                            }); 
                            marker.setMap(mapObj);  //在地图上添加点
                            mapObj.setFitView(); //调整到合理视野 

                            var bb = function (e) {
                                $("#Location").val(marker.getPosition());
                            };
                            AMap.event.addListener(marker, "dragend", bb);
                        }
                    </script>
                }
            </dd>
        </dl>
    </div>
    <div class="tab-content" style="display: none">
        <dl>
            <dt>停车位</dt>
            <dd> 
                @Html.TextBoxFor(model => model.Parking, null, new { @class = "input small", datatype = "n",@value="0" })
                <span class="Validform_checktip">个</span> 
            </dd>
        </dl>

        <dl>
            <dt>餐具是否免费</dt>
            <dd>
                <div class="rule-multi-radio">
                    <label for="watermarktype">否</label>
                    @Html.RadioButtonFor(model => model.Cutlery, 0, new { @id = "radio1", @name = "Cutlery" ,@checked="checked" })
                    <label for="watermarktype">是</label>
                    @Html.RadioButtonFor(model => model.Cutlery, 1, new { @id = "radio2", @name = "Cutlery" })
                </div>

            </dd>
        </dl>
        <dl>
            <dt>有无wifi</dt>
            <dd>
                <div class="rule-multi-radio">
                    <label for="watermarktype">无</label>
                    @Html.RadioButtonFor(model => model.WIFI, 0, new { @id = "radio1", @name = "WIFI",@checked="checked"  })
                    <label for="watermarktype">有</label>
                    @Html.RadioButtonFor(model => model.WIFI, 1, new { @id = "radio2", @name = "WIFI" })
                </div> 
            </dd>
        </dl> 
        <dl>
            <dt>特色描述</dt>
            <dd>  
                @Html.TextAreaFor(model => model.Feature, 5, 105, new { @class = "input" })
                <span class="Validform_checktip"></span>

            </dd>
        </dl>
        <dl>
            <dt>促销描叙</dt>
            <dd>
                @Html.TextAreaFor(model => model.Promotional, 5, 105, new { @class = "input" }) 
                <span class="Validform_checktip"></span>

            </dd>
        </dl>
    </div>
    <!--/酒店基本信息-->
     <!--酒店认证-->
    <div class="tab-content" style="display: none">
        
        <dl>
            <dt>营业执照</dt>
            <dd>

                @Html.HiddenFor(model => model.License) 
                <input type="file" id="boy" name="boy" class="input normal upload-path" />
                <input type="button" value="上传" id="submitImg" class="btn btn-default" />
                    
                <div class="photo-list">
                    <ul>
                        @if (Model.License != null)
                        {
                            <li>
                                <input type="hidden" name="hid_photo_name" value="@Model.H_id|@Model.License|" />
                                <div class="img-box" onclick="setFocusImg(this);"> <a id="showimg" title="点击图片查看大图" href="../@Model.License" class="thickbox">
                                                                                       <img src="../@Model.License" bigsrc="|@Model.License"  id="img1"/>
                                                                                       <span class="remark"><i>营业执照</i></span>   </a>
                                </div>
                                @*     <a href="javascript:;" onclick="setRemark(this);">描述</a>*@
                                <a href="javascript:;" onclick="delImgServer(this,@Model.H_id);">删除</a>
                            </li>
                        } 
              

                    </ul>
                </div>
                @*
                        <a id="showimg" title="点击图片查看大图" href="@Model.License" class="thickbox">
                            <img id="img1" alt="营业执照" width="300" src="@Model.License" />
                        </a>
                        <a href="javascript:;" onclick="delImgServer(this,@Model.H_id);">删除</a>*@
                   
            </dd>
        </dl>
        <div style="text-align: center;color: red">
            更新营业执照后，请点击下方的提交按钮保存。
        </div>
    </div>
    <!--酒店认证-->
    <!--/内容-->
   
    <!--工具栏-->
    <div class="page-footer">
        <div class="btn-list">
            <input type="submit" value="提交保存" class="btn" onclick="changecity()"  name="btnSubmit"/>
            <input name="btnReturn" type="button" value="返回上一页" class="btn yellow" onclick="javascript: history.back(-1);" />
            <span style="color: red">@ViewBag.msg</span>
        </div>
        <div class="clear"></div>
    </div>
    <!--/工具栏-->
}